extends MoveElement


class_name TailElement
"""
绘制移动轨迹
"""


## 最大的轨迹点数目
@export var max_tail_count: int = 50

## 引用的轨迹
@export var tail_line2D: Line2D = null


func __check_exports() -> Dictionary:
    return IComponent.merge({
        "tail_line2D": IComponent.find_child.bind(self, func(x): return x is Line2D, tail_line2D),
    }, super.__check_exports())

func reset():
    tail_line2D.clear_points()
    super.__reset()

func yield_move(delta: float) -> Vector2:
    ShapeDraw.draw_tail(move_component.wrapper, tail_line2D, max_tail_count)
    return Vector2.ZERO
